// 全局配置
export class LvConfig {
  // 路径配置
  static assetsPrefixPath: string = '';
  // 国际化
  static language: 'zh-cn' | 'en-us' = 'zh-cn';
  // Tree
  static treeOptions: {
    lvBlockNode?: boolean;
  } = {};

  /**
   * search
   */
  static searchOptions: {
    lvMaxLength?: number;
  } = {};

  /**
   * cascader
   */
  static cascaderOptions: {
    lvShowClear?: boolean;
  } = {};

  // slider
  static sliderOptions: {
    lvTheme?: 'light' | 'dark';
  } = {};

  // tooltip
  static tooltipOptions: {
    lvTheme?: 'light' | 'dark';
  } = {};

  // 日历
  static calendarOptions: {
    firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
  } = {};

  /**
   * select
   */
  static selectOptions: {
    lvShowClear: boolean;
  } = {
    lvShowClear: false,
  };

  static breadcrumbOptions: {
    lvFullPath?: boolean;
  } = {
    lvFullPath: true,
  };

  // popover
  static popoverOptions: {
    lvTheme?: 'light' | 'dark';
    lvMaskTransparent?: boolean;
  } = {};

  // overflow
  static overflowOptions: {
    lvTheme?: 'light' | 'dark';
    lvKeepWhiteSpace?: boolean;
  } = {};

  // timeSlider
  static timeSliderOptions: {
    lvTheme?: 'light' | 'dark';
    lvTimezoneOffset?: number;
  } = {};

  // ipInput
  static ipOptions: {
    lvIsShorthand?: boolean;
    lvShowPort?: boolean;
    lvBlock?: boolean;
  } = {};

  // DataTable
  static dataTableOptions: {
    lvDisableSortClear?: boolean;
    lvResizeMinWidth?: number;
    lvKeepWhiteSpace?: boolean;
  } = {};

  // 操作按钮
  static operationMenuOptions: {
    lvMaxShowNum?: number;
    lvMenuText?: string;
    lvShowMode?: 'default' | 'dropdown';
  } = {
    lvMaxShowNum: 3,
  };

  // 分页器
  static paginatorOptions: {
    lvPageSize: number;
    lvPageSizeOptions: number[];
  } = {
    lvPageSize: 25,
    lvPageSizeOptions: [10, 25, 50, 100],
  };

  // 表单
  static formOptions: {
    lvLabelColon: boolean;
    lvKeepRequiredWidth?: boolean;
    lvLayout?: 'horizontal' | 'vertical';
  } = {
    lvLabelColon: true,
    lvLayout: 'vertical',
  };

  // 信息提示框
  static messageBoxOptions: {
    lvWidth?: any;
    lvKeyboardEscape?: boolean;
    lvOuterClosable?: boolean;
    lvDraggable?: boolean;
    lvMaskTransparent?: boolean;
  } = {
    lvDraggable: true,
  };

  /**
   * TimePicker
   */
  static timePickerOptions: {
    lvReadonly: boolean;
    lvShowClear: boolean;
    lvNowAsBaseTime: boolean;
    lvTimezoneOffset?: number;
  } = {
    lvReadonly: false,
    lvShowClear: true,
    lvNowAsBaseTime: false,
  };

  // 通知提醒
  static notificationOptions: {
    lvWidth?: number;
    lvMaxStacks?: number;
    lvDuration?: number;
    lvKeepShowOnHover?: boolean;
    lvPosition?: string;
    lvOffset?: { x?: number; y?: number };
  } = {
    lvMaxStacks: 3,
    lvDuration: 0,
    lvKeepShowOnHover: true,
  };

  /**
   * DatePicker
   */
  static datePickerOptions: {
    lvShowClear: boolean;
    lvTimezoneOffset?: number;
    lvNowAsBaseTime?: boolean;
    lvFormat?: string | ((date: Date) => string);
    lvReadonly?: boolean;
    lvBackfillDisabledDate?: boolean;
  } = {
    lvShowClear: true,
    lvReadonly: false,
    lvBackfillDisabledDate: false,
  };

  // 全局提示
  static messageOptions: {
    lvWidth?: string | number;
    lvMaxWidth?: string | number;
    lvMaxStacks?: number;
    lvDuration?: number | number[];
    lvKeepShowOnHover?: boolean;
    lvShowCloseButton?: boolean;
    lvPosition?: string;
    lvOffset?: { x?: number; y?: number };
    lvRenderType?: 'html' | 'text';
  } = {
    lvMaxStacks: 5,
    lvDuration: 3000,
    lvKeepShowOnHover: true,
  };

  // 對話框，需要初始值，否則會報錯
  static modalOptions: {
    lvKeyboardEscape?: boolean;
    lvOuterClosable?: boolean;
    lvDraggable?: boolean;
    lvMaskTransparent?: boolean;
    lvDrawerPosition?: 'top' | 'bottom' | 'left' | 'right';
    lvDrawerPositionOffset?: [any, any, any, any];
    lvOkLoadingText?: string;
    lvCancelLoadingText?: string;
    lvResize?: boolean | { max: number; min: number };
  } = {
    lvKeyboardEscape: false,
    lvOuterClosable: false,
    lvMaskTransparent: false,
    lvDraggable: true,
    lvDrawerPosition: 'right',
    lvDrawerPositionOffset: ['0px', '0px', '0px', '0px'],
    lvResize: false,
  };
}
